package com.gary.demo.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//@WebFilter(filterName = "customFilter1",urlPatterns = {"/*"})
public class CustomFilter1 implements Filter {

    private final Logger logger = LoggerFactory.getLogger(CustomFilter1.class);

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        logger.info("filter1 init ....");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
        throws IOException, ServletException {
        logger.info("doFilter1...");
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {
        logger.info("destroy1");
    }
}
